package com.jzr.bedside.ui.fragment.hospital

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.jzr.bedside.R
import com.jzr.bedside.base.BaseFragment
import com.jzr.bedside.bean.DeptIntroBean
import com.jzr.bedside.bean.HospitalIntroBean
import com.jzr.bedside.presenter.contract.HospitaDetailsFragmentContract
import com.jzr.bedside.presenter.impl.HospitaDetailsFragmentImpl
import com.jzr.bedside.utils.PreferUtil
import kotlinx.android.synthetic.main.fragment_hospita_details.*

class DeptDetailsFragment:BaseFragment(), HospitaDetailsFragmentContract.View {

    private  val mPresenter= HospitaDetailsFragmentImpl()

    companion object {
        fun getInstance(): DeptDetailsFragment? {
            return DeptDetailsFragment()
        }
    }

    override fun getLayoutResId(): Int {
        return  R.layout.fragment_hospita_details
    }

    override fun attachView() {
        mPresenter.attachView(this)
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        state: Bundle?
    ): View? {
        mPresenter.getDeptIntro(activity,"deptCode", PreferUtil.getInstance().deptCode)

        return super.onCreateView(inflater, container, state)
    }

    override fun getHospitalIntroSuccess(data: HospitalIntroBean?) {

    }

    override fun getDeptIntroSuccess(dataDeptIntroBean: DeptIntroBean) {
        bridgeWebView.loadUrl(dataDeptIntroBean.data?.intro)
    }

    override fun showError(message: String?) {

    }

}